include(3rd/qxmpp/qxmpp.pri)

QT += qml quick widgets multimedia sql

CONFIG += c++11

INCLUDEPATH += $$QXMPP_INCLUDEPATH

FORMS += \
	resources/form/XmlConsoleDialog.ui

HEADERS += \
    src/QmlObjectRegister.h \
    src/config/Config.h \
    src/model/RosterModel.h \
    src/util/PhotoUtil.h \
    src/multimedia/AudioPlayer.h \
    src/util/Screenshot.h \
    src/util/callonce.h \
    src/util/Singleton.h \
    src/multimedia/AudioRecorder.h \
    src/multimedia/VideoRecorder.h \
    src/model/submodel/ContactModel.h \
    src/model/submodel/SessionModel.h \
    src/model/submodel/GroupModel.h \
    src/global/xnamespace.h \
    src/global/xglobal.h \
    src/global/QmlNames.h \
    src/model/submodel/GroupMemberModel.h \
    src/model/GroupsModel.h \
    src/model/SessionsModel.h \
    src/model/LocalUserModel.h \
    src/util/optional.h \
    src/persist/DbManager.h \
    src/model/submodel/MessageModel.h \
    src/model/MessagesManager.h \
    src/ApplicationEngine.h \
    src/util/FileUtil.h \
    src/model/submodel/MessageListModel.h \
    src/model/submodel/GroupMemberListModel.h \
    src/model/submodel/VCard.h

SOURCES += \
    src/main.cpp \
    src/QmlObjectRegister.cpp \
    src/config/Config.cpp \
    src/model/RosterModel.cpp \
    src/util/PhotoUtil.cpp \
    src/multimedia/AudioPlayer.cpp \
    src/util/Screenshot.cpp \
    src/multimedia/AudioRecorder.cpp \
    src/multimedia/VideoRecorder.cpp \
    src/model/submodel/ContactModel.cpp \
    src/model/submodel/SessionModel.cpp \
    src/model/submodel/MessageModel.cpp \
    src/model/submodel/GroupModel.cpp \
    src/global/QmlNames.cpp \
    src/model/submodel/GroupMemberModel.cpp \
    src/model/GroupsModel.cpp \
    src/model/SessionsModel.cpp \
    src/model/LocalUserModel.cpp \
    src/persist/DbManager.cpp \
    src/model/MessagesManager.cpp \
    src/ApplicationEngine.cpp \
    src/util/FileUtil.cpp \
    src/model/submodel/MessageListModel.cpp \
    src/model/submodel/GroupMemberListModel.cpp \
    src/model/submodel/VCard.cpp

RESOURCES += \
    resources/qml.qrc

# Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH =

# Additional import path used to resolve QML modules just for Qt Quick Designer
QML_DESIGNER_IMPORT_PATH =

# The following define makes your compiler emit warnings if you use
# any feature of Qt which as been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS

DISTFILES += \
    readme.md \
    resources/config/app.config.json \
    doc/general/mvc.md \
    doc/general/build.md \
    doc/general/specification.md \
    resources/schema/schema.update.sql \
    resources/schema/schema.init.sql \
    doc/general/database.md \
    doc/general/issue.md \
    doc/general/ichat.md \
    doc/general/import_ehr_users_by_ldap.md \
    doc/general/deploy.md \
    doc/general/local_data.md

# 与平台相关特定配置
win32 {
    LIBS += $$PWD/lib/win/$${QXMPP_LIBRARY_NAME}0.lib                   # 动态链接库

    RC_ICONS += resources/icon/xchat.ico				# 应用程序图标
}
macx: {
    LIBS += $${PREFIX}/$${LIBDIR}/libqxmpp.$${QXMPP_VERSION}.dylib	# 动态链接库，链接到release版本

    ICON += resources/icon/xchat.icns                                   # 应用程序图标
    QMAKE_INFO_PLIST = resources/macos/Info.plist			# macOS平台属性文件
}
unix:!macx {
	SOURCES += hellolinux.cpp
}

# 应用程序版本，组织
VERSION = 1.0.0

# 定义在代码中用获取版本号的宏
DEFINES += APP_VERSION=\\\"$$VERSION\\\"
DEFINES += APP_ORG=\\\"Healthway\\\"
DEFINES += APP_NAME=\\\"XChat\\\"

# 部署动作默认规则
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target

# 部署文件,注意需要加个引号，XCOPY对长文件名的支持有问题
win32 {
	CONFIG(debug, debug|release){
		COPY_CONFIG.commands = $(COPY_DIR)    \"$${PWD}/resources/config\"    \"$${OUT_PWD}/debug/resources/config\"
		COPY_SCHEMA.commands = $(COPY_DIR)    \"$${PWD}/resources/schema\"    \"$${OUT_PWD}/debug/resources/schema\"

		# COPY_DLL.commands = \"\"
		# COPY_DLL.commands = $(COPY_FILE)    \"$$[QT_INSTALL_BINS]/Qt5Core.dll\"    \"$${OUT_PWD}/debug/Qt5Core.dll\"
		#QtCored.commands = copy   /Y   \"$$[QT_INSTALL_BINS]/Qt5Cored.dll\"   \"$${OUT_PWD}/debug\"
		#QtCored.target = debug/QtCored5.dll
		#QtGuid.commands = copy /Y   \"$$[QT_INSTALL_BINS]/Qt5Guid.dll\"   \"$${OUT_PWD}/debug\"
		#QtGuid.target = debug/QtGuid5.dll

		#QMAKE_EXTRA_TARGETS += QtCored QtGuid
		#PRE_TARGETDEPS += debug/Qt5Cored.dll debug/Qt5Guid.dll
	} else:CONFIG(release, debug|release){
		COPY_CONFIG.commands = $(COPY_DIR)    \"$${PWD}/resources/config\"    \"$${OUT_PWD}/release/resources/config\"
		COPY_SCHEMA.commands = $(COPY_DIR)    \"$${PWD}/resources/schema\"    \"$${OUT_PWD}/release/resources/schema\"

		COPY_DLL.commands = $(COPY_DIR)    \"$${QTDIR}/bin/QtCore.dll\"    \"$${OUT_PWD}/release\"
	}

	first.depends = $(first) COPY_CONFIG COPY_SCHEMA COPY_DLL

	export(first.depends)
	export(COPY_CONFIG.commands)
	export(COPY_SCHEMA.commands)
	export(COPY_DLL.commands)

	QMAKE_EXTRA_TARGETS += first COPY_CONFIG COPY_SCHEMA COPY_DLL
}
